import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect:"/layout" //重定向到其他页面
  },
  {//一级路由
    path:"/shop",
    name:"shop",
    component:()=>import("../views/shop/index.vue")
  },
  {
    path: '/layout',
    name: 'layout',
    component: () => import('../views/layout/index.vue'),
    children:[ //layout的子路由
      { //天气工具
        path:"temp",name:"temp",component:()=>import("../views/tempture/index.vue")
      },
       { //日常工具
        path:"richang",name:"richang",component:()=>import("../views/richang/index.vue")
      },
      { //每日英语
        path:"dayen",
        name:"dayen",
        component:()=>import("../views/dayEn/index.vue")
      },
      {//test练习的增删改查
         path:"test",
         name:"test",
         component:()=>import("../views/test/index.vue")
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history', 
  
  base: process.env.BASE_URL,

  routes
})
  console.log(process.env.NODE_ENV);
export default router

